package com.ms.service.impl;


import com.ms.mapper.UserResignMapper;
import com.ms.pojo.Resign_apply;
import com.ms.service.UserResignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class UserResignServiceImpl implements UserResignService {
    @Autowired
    private UserResignMapper userResignMapper;


    @Override
    public int insertResignApply(Resign_apply resign_apply) {
        try {
            // 设置默认字段
            resign_apply.setApplyTime(new Date());
            resign_apply.setApplyStatus(0); // 默认待审核状态
            resign_apply.setEmpId(1);       // 可替换为实际员工ID

            // 执行插入操作
            return userResignMapper.insertResignApply(resign_apply);
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("插入离职申请失败", e);
        }
    }
}
